/*package com.promfy.anonymousshare;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.TextView;

public class CopyOfHomeActivity extends Activity implements OnClickListener, OnPageChangeListener{

	private LinearLayout linear1;
	private List<View> views;
	private ViewPager vp;
	private ViewPagerAdapter vpAdapter;
	private LinearLayout linear2;
	private Handler handler = new Handler();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
//		TextView textView=new TextView(this);
		
		setContentView(R.layout.tab_main);
		
		linear1 = (LinearLayout) findViewById(R.id.linear1); 
		linear2 = (LinearLayout) findViewById(R.id.linear2); 
		
		findViewById(R.id.button1).setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				if(linear1.getVisibility() != View.GONE){
					linear1.setVisibility(View.GONE);
				}else{
					linear1.setVisibility(View.VISIBLE);					
				}
			}
		});

		views = new ArrayList<View>();
		LinearLayout.LayoutParams mParams = new LinearLayout.LayoutParams(
				LinearLayout.LayoutParams.FILL_PARENT,
				100);

		int[] color = new int[]{Color.BLUE,Color.RED,Color.GREEN,Color.YELLOW,Color.GRAY};
		for (int i = 0; i < 5; i++) {
			TextView tv = new TextView(this);
			tv.setBackgroundColor(color[i]);
			tv.setLayoutParams(mParams);
			views.add(tv);
		}
		vp = (ViewPager) findViewById(R.id.viewpager);
		vpAdapter = new ViewPagerAdapter(views);
		vp.setAdapter(vpAdapter);
		vp.setOnPageChangeListener(this);

		initDots();
		
		new Thread(new Runnable() {
			
			@Override
			public void run() {
				for(int i =0; i < 5 ; i++){
					try {
						Thread.sleep(1000 * 2);
					} catch (InterruptedException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
					final int j = i;
					handler.post(new Runnable() {
						
						@Override
						public void run() {
							// TODO Auto-generated method stub
							if(j==4){
								
								vp.setCurrentItem(j);
							}else{
								vp.setCurrentItem(j, true);
							}
						}
					});
					if(i==4) i=-1;
				}
				
			}
		}).start();
	}
	
    private void initDots() {

        for (int i = 0; i < 5; i++) {
          TextView t = new TextView(this);
          t.setBackgroundColor(Color.LTGRAY);
          LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(5,5);
          p.leftMargin = 10;
          p.topMargin = 10;
          p.rightMargin = 10;
          p.bottomMargin = 10;
          t.setLayoutParams(p);
          linear2.addView(t);
        } 
        linear2.getChildAt(0).setBackgroundColor(Color.DKGRAY);
//
//        currentIndex = 0;
//        dots[currentIndex].setEnabled(false);
    }
    
    *//**
     *//*
    private void setCurView(int position)
    {
//        if (position < 0 || position >= pics.length) {
//            return;
//        }

        vp.setCurrentItem(position);
    }

    *//**
     *//*
    private void setCurDot(int position)
    {
//        if (positon < 0 || positon > pics.length - 1 || currentIndex == positon) {
//            return;
//        }

//        dots[positon].setEnabled(false);
//        dots[currentIndex].setEnabled(true);
//
//        currentIndex = positon;
    	
    	int count = linear2.getChildCount();
    	for(int i = 0; i < count; i++){
    		if(i == position){
    			linear2.getChildAt(i).setBackgroundColor(Color.DKGRAY);
    		}else{
    			linear2.getChildAt(i).setBackgroundColor(Color.LTGRAY);
    		}
    	}
    }

    @Override
    public void onPageScrollStateChanged(int arg0) {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void onPageScrolled(int arg0, float arg1, int arg2) {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void onPageSelected(int arg0) {
        setCurDot(arg0);
    }

    @Override
    public void onClick(View v) {
        int position = (Integer)v.getTag();
        setCurView(position);
        setCurDot(position);
    }
	
	public class ViewPagerAdapter extends PagerAdapter{
	    
	    private List<View> views;
	    
	    public ViewPagerAdapter (List<View> views){
	        this.views = views;
	    }

	    @Override
	    public void destroyItem(View arg0, int arg1, Object arg2) {
	        ((ViewPager) arg0).removeView(views.get(arg1));        
	    }

	    @Override
	    public void finishUpdate(View arg0) {
	        // TODO Auto-generated method stub
	        
	    }

	    @Override
	    public int getCount() {
	        if (views != null)
	        {
	            return views.size();
	        }
	        
	        return 0;
	    }
	    

	    @Override
	    public Object instantiateItem(View arg0, int arg1) {
	        
	        ((ViewPager) arg0).addView(views.get(arg1), 0);
	        
	        return views.get(arg1);
	    }

	    @Override
	    public boolean isViewFromObject(View arg0, Object arg1) {
	        return (arg0 == arg1);
	    }

	    @Override
	    public void restoreState(Parcelable arg0, ClassLoader arg1) {
	        // TODO Auto-generated method stub
	        
	    }

	    @Override
	    public Parcelable saveState() {
	        // TODO Auto-generated method stub
	        return null;
	    }

	    @Override
	    public void startUpdate(View arg0) {
	        // TODO Auto-generated method stub
	        
	    }

	}
}
*/